﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace mbine.msgc.controls
{
    public class BaseWindow : Window
    {
        protected Grid Base = new Grid();
        protected Grid TitleBar = new Grid();

        public BaseWindow()
        {
            this.ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip;
            this.WindowStyle = System.Windows.WindowStyle.None;
            this.AllowsTransparency = true;
            this.BorderThickness = new Thickness(3);
            this.BorderBrush = new SolidColorBrush(Colors.Black);

            this.Content = Base;

            RowDefinition gridTop = new RowDefinition();
            gridTop.Height = new GridLength(30);
            RowDefinition gridMain = new RowDefinition();
            RowDefinition gridBottom = new RowDefinition();
            gridBottom.Height = new GridLength(20);

            Base.RowDefinitions.Add(gridTop);
            Base.RowDefinitions.Add(gridMain);
            Base.RowDefinitions.Add(gridBottom);

            TitleBar.Height = 30;
            DockPanel.SetDock(TitleBar, Dock.Top);
            TitleBar.Background = new SolidColorBrush(Colors.DarkRed);
            Grid.SetRow(TitleBar, 0);
            Base.Children.Add(TitleBar);

            TitleBar.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(TitleBar_MouseLeftButtonDown);
        }

        void TitleBar_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            this.DragMove();
        }
    }
}